#ifndef FORM_H
#define FORM_H

#include <QWidget>

#define SHADOW_WIDTH  5
#define MARGIN 10//四个角的长度

class QHBoxLayout;
class QVBoxLayout;
class PushButton;
class MainWindow;
class QLabel;


class Form : public QWidget
{
    Q_OBJECT

public:
    explicit Form(QWidget *parent = 0);
    ~Form();
    MainWindow* getMainWindowAddr();
    int countFlag(QPoint p, int row);
    void setCursorType(int flag);
    int countRow(QPoint p);

protected:
  void mousePressEvent(QMouseEvent *event);
  void mouseReleaseEvent(QMouseEvent *event);
  void mouseDoubleClickEvent(QMouseEvent *event);
  void mouseMoveEvent(QMouseEvent *event);

private slots:
    void on_closePbtn_clicked();

    void on_maxPbtn_clicked();

    void on_pushButton_3_clicked();

private:
    bool isLeftPressed;
    int curPos;
    QPoint pLast;

    QHBoxLayout *mpTitleHbl;
    QVBoxLayout *mpMainVbl;
    PushButton *mpMinPbtn;
    PushButton *mpMaxPbtn;
    PushButton *mpClosePbtn;
    QLabel *mpTitleLbl;

    MainWindow *mpMainMwd;

    void setPushButton(PushButton *pbtn);
};

#endif // FORM_H
